The Dreamweaver JavaScript API > Selection functions > dom.getSelection() |
![]() ![]() ![]() |
Availability
Dreamweaver 3.0
Description
Gets the selection, expressed as character offsets into the document's HTML source code.
Arguments
bAllowMultiple
bAllowMultiple
is a Boolean value indicating whether the function should return multiple offsets if more than one table cell, image map hotspot, or layer is selected. If this argument is omitted, it defaults to false
.
Returns
For simple selections, an array containing two integers. The first integer is the character offset of the beginning of the selection. The second integer is the character offset of the end of the selection. If the two numbers are the same, then the current selection is an insertion point.
For complex selections (multiple table cells, multiple layers, or multiple image map hotspots), an array containing 2n
integers, where n
is the number of selected items. The first integer in each pair is the character offset of the beginning of the selection (including the opening TD
, DIV
, SPAN
, LAYER
, ILAYER
, or MAP
tag); the second integer in each pair is the character offset of the end of the selection (including the closing TD
, DIV
, SPAN
, LAYER
, ILAYER
, or MAP
tag). If multiple table rows are selected, the offsets of each cell in each row are returned. The selection never includes the TR
tags.
Enabler
None.
![]() ![]() ![]() |